package com.example.config;

import io.minio.MinioClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: shenjianZ
 * @Date: 2024/4/29 下午3:06
 * @Description:
 */

@Configuration
@Slf4j
public class MinioConfiguration {

    @Value("${spring.minio.endpoint}")
    String endPoint;
    @Value("${spring.minio.username}")
    String username;
    @Value("${spring.minio.password}")
    String password;

    @Bean
    public MinioClient minioClient() {
        log.info("Minio 客户端正在初始化......");
        return MinioClient.builder().
                endpoint(endPoint)
                .credentials(username, password)
                .build();
    }
}
